library(GSVA)
library(GSEABase)
library(clusterProfiler)
library(GSEA)
install.packages("devtools")
install.packages("rJava")
library(rJava)
library(devtools)
library(usethis)
install.packages("remotes")
library(remotes)
install_github("rcastelo/GSVA")
devtools::install_github("GSEA-MSigDB/GSEA_R")
BiocManager::install("GSVA")
install.packages('src')
library(rJava)
library(devtools)
library(usethis)
devtools::install_local("/Users/chengyuhang/Desktop/GSVA-devel")  #镜像选择all-- 1

setwd("/Users/chengyuhang/Desktop")

kegggmt2 <- read.gmt("c2.cp.kegg.v7.4.symbols.gmt")
kegg_list = split(kegggmt2$gene,kegggmt2$term)

expr = as.matrix(expr)
kegg2 <- gsva(nromalized.data,kegg_list,kcdf= "Gaussian",method = "gsva")

annotation_col = data.frame(
  Tissuetype = c(rep("Stomach",174),rep("solid Tissue Normal", 32),rep("Tumor",375)),
  Daeabase = c(rep("GTEX",174),rep("TCGA",407))
)
rownames(annotation_col)=colnames(nromalized.data)

p1 <- pheatmap::pheatmap(kegg2[1:20,],
                         cluster_rows = T,
                         cluster_cols = F,
                         annotation_col = annotation_col,
                         show_colnames = F,
                         scale = "row",
                         color = colorRampPalette(c("#ff7744","white","#AAAAAA","#0044bb"))(100)
                         )
library(ggplot2)
ggsave(filename = "kkeg20.pdf",plot = p1)

library(msigdbr)
install.packages("msigdbr")
h.kegg = msigdbr(species = "Homo sapiens",category = "c2",subcategory = "KEGG")
h.kegg=h.kegg[,c(3,4)]
h.kegg_list = split(h.kegg$gene_symbol,h,kegg$gs_name)






